package com.platform.hospital.wx;

import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.xml.XmlConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Created by asus on 2018/3/1.
 */
public class WxServer {

    private static Logger logger = LoggerFactory
            .getLogger(WxServer.class);

    public static void main(String[] args) throws Exception {
        logger.info("start WxServer ... ");
        Resource fileXml;
        Server server=null;
        try {
            fileXml = Resource.newSystemResource("jetty.xml");
            XmlConfiguration configuration = new XmlConfiguration(
                    fileXml.getInputStream());
            server= (Server) configuration.configure();
            server.start();
            logger.info("start WxServer success");
        } catch (Exception e) {
            logger.error("Error", e);
            if(server!=null){
                server.stop();
            }
            logger.info("start WxServer fails");
        }
    }
}
